package com.xh.demo.commons.utils;

import java.util.Collection;
import java.util.Map;

/**
 * @author wen
 * @apiNote 对象校验工具类
 * @since 2021/12/11
 */
public class ValidUtil {

    public static boolean isNull(CharSequence parameter) {
        return parameter == null || parameter.length() == 0;
    }

    public static boolean isNotNull(CharSequence parameter) {
        return !isNull(parameter);
    }

    public static boolean isNull(Collection<?> parameter) {
        return parameter == null || parameter.isEmpty();
    }

    public static boolean isNotNull(Collection<?> parameter) {
        return !isNull(parameter);
    }

    public static boolean isNull(Object[] parameter) {
        return parameter == null || parameter.length == 0;
    }

    public static boolean isNotNull(Object[] parameter) {
        return !isNull(parameter);
    }

    public static boolean isNull(Map<?, ?> parameter) {
        return null == parameter || parameter.isEmpty();
    }

    public static boolean isNotNull(Map<?, ?> parameter) {
        return !isNull(parameter);
    }

    public static boolean isNull(Object parameter) {
        return parameter == null;
    }

    public static boolean isNotNull(Object parameter) {
        return !isNull(parameter);
    }

}
